//Sunday, November 29 2009
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <math.h>
#include <sstream>
#include <algorithm>

using namespace std;

class ArithmeticProgression
{
public:
	double minCommonDifference(int a0, vector <int> seq)
	{
		pair<long long, long long> ret(0,1);
		for(int i=0; i<seq.size(); i++)
		{
			if((seq[i]-a0)*ret.second > ret.first*(i+1))
			{
				ret.first = seq[i] - a0;
				ret.second = i + 1;
			}
		}

		for(int i=0; i<seq.size(); i++)
			if(seq[i] != floor(a0 + (i+1)*ret.first/ret.second))
				return -1;
		return 1.0 * ret.first / ret.second;
	}
};
